<%@taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="engineer.clientapp.beans.User" %>

<%
User user=(User)session.getAttribute("user");

%>
<%if (session.getAttribute("user") == null) {%>
<h1>Brak dostępu do tej strony!</h1>
<%}else{ 
String name=user.getName();
String surname=user.getSurname();
String email=user.getEmail();
String address=user.getAddress();
String foto=user.getFoto();%>
<h1>Panel Użytkownika</h1>
<div id="gallery_container">
<h3>Edytuj Dane:</h3>
<html:form action="editAccount" enctype="multipart/form-data">
<table>
		<tr>
		<td><label class="panel" for="login"><bean:message key="label.user.email" /> </label></td> <td><input id="email" name="email" type="text" value=<%=email %> /></td>
		</tr>
		
		<tr>
		<td><label class="panel" for="login"><bean:message key="label.user.name" /> </label></td> <td><input id="name" name="name" type="text" value=<%=name %> /></td> <td rowspan="3"><div class="image_wrapper image_fl">
	<img src="images/users/<%=foto %>" alt="image" class="image_frame_100" />
</div></td>
		</tr>
		
		<tr>
		<td><label class="panel" for="login"><bean:message key="label.user.surname" /> </label></td> <td><input id="surname" name="surname" type="text" value=<%=surname %> /></td> 
		</tr>
		
		<tr>
		<td><label class="panel" for="login"><bean:message key="label.user.address" /> </label></td> <td><input id="address" name="address" type="text" value=<%=address %> /></td> 
		</tr>
		
		<tr>
		<td><label class="panel" for="login"><bean:message key="label.user.password" /> </label> <td><input id="password" name="password" type="password" /></td> 
		</tr>
		
	
		
		</table> 
		
		<br>
		<center><input type="submit" class="styled-button-2" value="Zatwierdź"/></center>
		<p class="forgot-password">
		
			<font color="red"><html:errors property="error" /></font></p>

</html:form>
<br><br>

<h3>Zmień hasło do konta:</h3><br>
<html:form action="changePassword">
	<table>
		<tr>
			<td style="width: 660em;"><label class="panel" for="login"><bean:message key="label.user.oldPassword" /></label></td>
			<td><input type="password" name="oldPassword" id="oldPassword" /></td>
		</tr>
		<tr>
			<td><label class="panel" for="login"><bean:message key="label.user.newPassword" /> </label></td>
			<td><input type="password" name="newPassword" id="newPassword" /></td>
		</tr>
		<tr>
			<td><label class="panel" for="login"><bean:message key="label.user.confirmPassword" /> </label></td>
			<td><input type="password" name="confPassword" id="confPassword" /></td>
		</tr>
	</table><br>
	<center><input type="submit" class="styled-button-2" class="submit" value="Zmień" /><br>
	<font color="red"><html:errors property="errors" /></font></center>
</html:form>

<%} %>
</div>